import $store from '@/store/index.js';
import groupApi from "@/services/api/group.js"
import groupMembersSqlite from '@/sqlite_services/group_members.js'
import groupSqlite from '@/sqlite_services/group.js'
//退出群聊
const handle = async(data)=>{
	try{
		let myid = $store.state.user.user_info.user_id
		//目前这里有点小问题，就是如果是本人操作退群的话，api还会执行一遍同样的
		if(data.user_id == myid){
			groupApi.outOrDissolve(data.target_id)
		}
		//发送全局通知,通知页面删除好友
		uni.$emit('onGroupMemberAction',{
			type:'quit',
			data:{
				group_id:data.target_id,
				user_ids:[data.user_id]
			}
		})
	}catch(e){
		
	}
}
export default handle